﻿using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using HandyControl.Tools.Extension;
using WWLauncher.Interface;
using WWLauncher.ViewModel;

namespace WWLauncher.View.UserControls.Config
{
    /// <summary>
    /// AdvancedControl.xaml 的交互逻辑
    /// </summary>
    public partial class AdvancedControl : UserControl, IChildrenWindow
    {
        private readonly AppConfig Config = MainViewModel.Instance().AppConfig;
        public AdvancedControl()
        {
            this.DataContext = Config;
            InitializeComponent();
            this.Loaded += AdvancedControl_Loaded;
        }

        private void AdvancedControl_Loaded(object sender, RoutedEventArgs e)
        {

        }

        public MainWindow ParentWindow { get; set; }

        private void ToggleMonitor_OnChecked(object sender, RoutedEventArgs e)
        {
            if (ParentWindow == null)
            {
                return;
            }

            ParentWindow.DisplayMonitor();

        }
        private void TogglePowerManagement_OnChecked(object sender, RoutedEventArgs e)
        {
            if (ParentWindow == null)
            {
                return;
            }
            if (Config.EnablePowerManagement)
            {
                ParentWindow.PowerNotify.Show();
            }
            else
            {
                ParentWindow.PowerNotify.Hide();
            }


        }
    }
}
